home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / TranslationExtensions.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  6.0 KB  |  192 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        TranslationExtensions.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT TranslationExtensions;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __TRANSLATIONEXTENSIONS__}
  27. {$SETC __TRANSLATIONEXTENSIONS__ := 1}
  28.  
  29. {$I+}
  30. {$SETC TranslationExtensionsIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __MEMORY__}
  35. {$I Memory.p}
  36. {$ENDC}
  37. {    Types.p                                                        }
  38. {        ConditionalMacros.p                                        }
  39. {    MixedMode.p                                                    }
  40.  
  41. {$IFC UNDEFINED __FILES__}
  42. {$I Files.p}
  43. {$ENDC}
  44. {    OSUtils.p                                                    }
  45.  
  46. {$IFC UNDEFINED __QUICKDRAW__}
  47. {$I Quickdraw.p}
  48. {$ENDC}
  49. {    QuickdrawText.p                                                }
  50.  
  51. {$IFC UNDEFINED __COMPONENTS__}
  52. {$I Components.p}
  53. {$ENDC}
  54.  
  55. {$PUSH}
  56. {$ALIGN MAC68K}
  57. {$LibExport+}
  58.  
  59. CONST
  60.     kSupportsFileTranslation    = 1;
  61.     kSupportsScrapTranslation    = 2;
  62.     kTranslatorCanGenerateFilename = 4;
  63.  
  64.     
  65. TYPE
  66.     FileType = OSType;
  67.  
  68.     ScrapType = ResType;
  69.  
  70.     TranslationAttributes = LONGINT;
  71.  
  72.  
  73. CONST
  74.     taDstDocNeedsResourceFork    = 1;
  75.     taDstIsAppTranslation        = 2;
  76.  
  77.  
  78. TYPE
  79.     FileTypeSpec = RECORD
  80.         format:                    FileType;
  81.         hint:                    LONGINT;
  82.         flags:                    TranslationAttributes;                    { taDstDocNeedsResourceFork, taDstIsAppTranslation}
  83.         catInfoType:            OSType;
  84.         catInfoCreator:            OSType;
  85.     END;
  86.     FileTranslationList = RECORD
  87.         modDate:                LONGINT;
  88.         groupCount:                LONGINT;
  89.         {     unsigned long    group1SrcCount;}
  90.         {     unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);}
  91.         {  FileTypeSpec    group1SrcTypes[group1SrcCount]}
  92.         {  unsigned long    group1DstCount;}
  93.         {  unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);}
  94.         {  FileTypeSpec    group1DstTypes[group1DstCount]}
  95.     END;
  96.     FileTranslationListPtr = ^FileTranslationList;
  97.     FileTranslationListHandle = ^FileTranslationListPtr;
  98.  
  99.     ScrapTypeSpec = RECORD
  100.         format:                    ScrapType;
  101.         hint:                    LONGINT;
  102.     END;
  103.     ScrapTranslationList = RECORD
  104.         modDate:                LONGINT;
  105.         groupCount:                LONGINT;
  106.         {     unsigned long        group1SrcCount;}
  107.         {     unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);}
  108.         {  ScrapTypeSpec        group1SrcTypes[group1SrcCount]}
  109.         {  unsigned long        group1DstCount;}
  110.         {     unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);}
  111.         {  ScrapTypeSpec        group1DstTypes[group1DstCount]}
  112.     END;
  113.     ScrapTranslationListPtr = ^ScrapTranslationList;
  114.     ScrapTranslationListHandle = ^ScrapTranslationListPtr;
  115.  
  116. { definition of callbacks to update progress dialog}
  117.     TranslationRefNum = LONGINT;
  118.  
  119. {****************************************************************************************
  120. *
  121. * This routine sets the advertisement in the top half of the progress dialog.
  122. * It is called once at the beginning of your DoTranslateFile routine.
  123. *
  124. * Enter:    refNum            Translation reference supplied to DoTranslateFile.
  125. *            advertisement    A handle to the picture to display.  This must be non-purgable.
  126. *                            Before returning from DoTranslateFile, you should dispose
  127. *                            of the memory.  (Normally, it is in the temp translation heap
  128. *                            so it is cleaned up for you.)
  129. *
  130. * Exit:    returns            noErr, paramErr, or memFullErr
  131. }
  132.  
  133. FUNCTION SetTranslationAdvertisement(refNum: TranslationRefNum; advertisement: PicHandle): OSErr;
  134.     {$IFC NOT GENERATINGCFM}
  135.     INLINE $7002, $ABFC;
  136.     {$ENDC}
  137. {****************************************************************************************
  138. *
  139. * This routine updates the progress bar in the progress dialog.
  140. * It is called repeatedly from within your DoTranslateFile routine.
  141. * It should be called often, so that the user will get feedback if he tries to cancel.
  142. *
  143. * Enter:    refNum        translation reference supplied to DoTranslateFile.
  144. *            progress    percent complete (0-100)
  145. *
  146. * Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  147. *            returns        noErr, paramErr, or memFullErr
  148. }
  149. FUNCTION UpdateTranslationProgress(refNum: TranslationRefNum; percentDone: INTEGER; VAR canceled: BOOLEAN): OSErr;
  150.     {$IFC NOT GENERATINGCFM}
  151.     INLINE $7001, $ABFC;
  152.     {$ENDC}
  153. { ComponentMgr selectors for routines}
  154.  
  155. CONST
  156.     kTranslateGetFileTranslationList = 0;                        { component selectors}
  157.     kTranslateIdentifyFile        = 1;
  158.     kTranslateTranslateFile        = 2;
  159.     kTranslateGetTranslatedFilename = 3;
  160.     kTranslateGetScrapTranslationList = 10;                        { skip to scrap routines}
  161.     kTranslateIdentifyScrap        = 11;
  162.     kTranslateTranslateScrap    = 12;
  163.  
  164. { Routines to implment in a file translation extension}
  165. TYPE
  166.     DoGetFileTranslationListProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; translationList: FileTranslationListHandle): ComponentResult; }
  167.  
  168.     DoIdentifyFileProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; (CONST)VAR theDocument: FSSpec; VAR docType: FileType): ComponentResult; }
  169.  
  170.     DoTranslateFileProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; refNum: TranslationRefNum; (CONST)VAR sourceDocument: FSSpec; srcType: FileType; srcTypeHint: LONGINT; (CONST)VAR dstDoc: FSSpec; dstType: FileType; dstTypeHint: LONGINT): ComponentResult; }
  171.  
  172.     DoGetTranslatedFilenameProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; dstType: FileType; dstTypeHint: LONGINT; VAR theDocument: FSSpec): ComponentResult; }
  173.  
  174. { Routine to implement in a scrap translation extension}
  175.     DoGetScrapTranslationListProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; list: ScrapTranslationListHandle): ComponentResult; }
  176.  
  177.     DoIdentifyScrapProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; dataPtr: UNIV Ptr; dataLength: Size; VAR dataFormat: ScrapType): ComponentResult; }
  178.  
  179.     DoTranslateScrapProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; refNum: TranslationRefNum; srcDataPtr: UNIV Ptr; srcDataLength: Size; srcType: ScrapType; srcTypeHint: LONGINT; dstData: Handle; dstType: ScrapType; dstTypeHint: LONGINT): ComponentResult; }
  180.  
  181.  
  182. {$ALIGN RESET}
  183. {$POP}
  184.  
  185. {$SETC UsingIncludes := TranslationExtensionsIncludes}
  186.  
  187. {$ENDC} {__TRANSLATIONEXTENSIONS__}
  188.  
  189. {$IFC NOT UsingIncludes}
  190.  END.
  191. {$ENDC}
  192.